#ifndef __ZIPLIST_HEADER__
#define __ZIPLIST_HEADER__

/*
    | zlbytes(4bytes) | zltail(4bytes) | zllen(2bytes) | entry1 | entry2 | ---- | zlend(1bytes) |
*/

/*
    | previous_entry_length | encoding | content |
*/
typedef struct zlentry
{
    unsigned int prevrawlensize;
    unsigned int prevrawlen;
    unsigned int lensize;
    unsigned int len;
    char encoding;
    //headersize = sizeof(previous_entry_length + encoding)
    unsigned int headersize;
    unsigned char *p;
} zlentry;
unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char *s, unsigned int slen);
unsigned int zipRawEntryLength(unsigned char *p);
int zipTryEncoding(unsigned char *entry, unsigned int entrylen, long long *v, unsigned char *encoding);
#endif